package cn.xshi.monitor.service.impl;

import cn.xshi.common.base.BaseService;
import cn.xshi.monitor.dao.IotCameraTypeDao;
import cn.xshi.monitor.model.IotCameraType;
import cn.xshi.monitor.service.IotCameraTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Desc 摄像机厂商类型
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Service
@Slf4j
public class IotCameraTypeServiceImpl extends BaseService implements IotCameraTypeService {

    @Resource
    IotCameraTypeDao iotCameraTypeDao;

    /**
     * 分页
     * @param condition
     * @return
     */
    public List<IotCameraType> getCameraTypeListByCondition(Map<String, Object> condition){
        return iotCameraTypeDao.getCameraTypeListByCondition(condition);
    }

    /**
     * 查询对象
     * @param id
     * @return
     */
    public IotCameraType getCameraTypeById(String id){
        return iotCameraTypeDao.getCameraTypeById(id);
    }

    /**
     * 添加
     * @param cameraType
     * @return
     */
    public int addCameraType(IotCameraType cameraType){
        cameraType.setCreateTime(getDate());
        cameraType.setId(toUUID());
        cameraType.setCreateId(getCurrentAccountId());
        return iotCameraTypeDao.addCameraType(cameraType);
    }

    /**
     * 修改
     * @param cameraType
     * @return
     */
    public int updateCameraType(IotCameraType cameraType){
        cameraType.setUpdateTime(getDate());
        cameraType.setUpdateId(getCurrentAccountId());
        return iotCameraTypeDao.updateCameraType(cameraType);
    }

    /**
     * 删除
     * @param condition
     * @return
     */
    public int delCameraType(Map<String, Object> condition){
        return iotCameraTypeDao.delCameraType(condition);
    }
}
